#include "database.h"
#include <QDebug>

bool Database::createConnection() {
    database = new QSqlDatabase();

    //set database driver to QSQLITE
    *database = QSqlDatabase::addDatabase("QSQLITE");

    database->setDatabaseName("D:\\mycodes\\CPP\\Kutuphane\\databases\\Kutuphane.db");

    database->setHostName("localhost");
    database->setUserName("");
    database->setPassword("");

    if(!database->open()) {
        qFatal( "Failed to connect." );
        return false;
    }
    else {
        //qDebug() << "Basarili";
        return true;
    }
}
